package application;

public class DivePlan {
	private int diveCase, depth, time;
	protected static final char INVALID_DIVE = '!';
	protected static final char INITIAL_GROUP = '?';

	protected static final int DECOMPRESSION = -1;
	protected static final int DIVE = 0;
	protected static final int SIT = 1;
	protected static final int DECOMPRESSION_DEPTH = 15;
	protected static final int SIT_DEPTH = 0;

	public DivePlan() {
		this(2, 0, 0);
	}

	public DivePlan(int diveCase, int depth, int time) {
		this.diveCase = diveCase;
		this.depth = depth;
		this.time = time;
	}

	private String parseDiveCase() {
		switch (diveCase) {
		case DECOMPRESSION:
			return "DECOMPRESSION: ";
		case DIVE:
			return "DIVE: ";
		case SIT:
			return "SIT: ";
		default:
			return "INVALID";
		}
	}

	public void setNewPlan(int diveCase, int depth, int time) {
		this.diveCase = diveCase;
		this.depth = depth;
		this.time = time;

	}

	public void setDiveCase(int diveCase) {
		setNewPlan(diveCase, depth, time);
	}

	public void setDepth(int depth) {
		setNewPlan(diveCase, depth, time);
	}

	public void setTime(int time) {
		setNewPlan(diveCase, depth, time);
	}

	public int getDiveCase() {
		return diveCase;
	}

	public int getDepth() {
		return depth;
	}

	public int getTime() {
		return time;
	}

	public String toString() {
		if (parseDiveCase() != "INVALID") {
			return parseDiveCase() + time + " min @" + depth + " ft.";
		} else {
			return parseDiveCase();
		}
	}
}
